<?xml version="1.0" encoding= "UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/common.xhtml">
	<ui:define name="content">
		<h:form>
			<p:panel id="newMessagePanel" header="New message">
				<h:panelGrid columns="2" cellpadding="5">
					<p:outputLabel for="to" value="Receiver:" />
                    
					<p:selectOneMenu id="to" value="#{messageBean.receiverId}">
						<f:selectItem itemLabel="Select One" itemValue="" />

						<f:selectItems value="#{userBean.self.friends}" var="friend"
							itemLabel="#{friend.firstName} #{friend.lastName}"
							itemValue="#{friend.userId}" />

					</p:selectOneMenu>
					

					<h3>Message text</h3>
					<p:inputTextarea rows="5" cols="30" maxlength="10"
						value="#{messageBean.currentText}" autoResize="false" />
					<h:outputText id="display" />

				</h:panelGrid>
				<p:commandButton value="Send" action="#{messageBean.saveMessage}">
				</p:commandButton>
				<p:commandButton value="Back" action="/messages/messages"
					style="margin-left:20px" />
				<br />
				<br />

			</p:panel>

		</h:form>


	</ui:define>

</ui:composition>


</html>